import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken(): undefined | string {
  return Cookies.get(TokenKey) === 'undefined' ? undefined : Cookies.get(TokenKey)
}

export function setToken(token: string, expires: number): void {
  Cookies.set(TokenKey, token, { expires })
}

export function removeToken(): void {
  Cookies.remove(TokenKey)
}
